package com.nandi.emergencyinspection.ui.activity

import android.content.Intent
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.nandi.emergencyinspection.R
import com.nandi.emergencyinspection.mvp.MessageContract
import com.nandi.emergencyinspection.ui.adapter.ListAdapter
import com.nandi.emergencyinspection.ui.adapter.VersionListAdapter
import com.tbright.ktbaselibrary.extension.isVisiable
import com.tbright.ktbaselibrary.mvp.BaseMvpActivity
import kotlinx.android.synthetic.main.activity_message.*
import kotlinx.android.synthetic.main.fragment_1.view.*
import kotlinx.android.synthetic.main.header_layout.*

class VersionActivity : BaseMvpActivity<MessageContract.MessagePresenter>(),
    MessageContract.MessageView {
    private val titles: ArrayList<String> = ArrayList()
    private var listAdapter: VersionListAdapter = VersionListAdapter(titles)
    var page = 0
    private var size = 10
    override fun getLayoutId(): Int {
        return R.layout.activity_version
    }

    override fun initView(savedInstanceState: Bundle?) {

        center_txt.text = "版本消息"
        left_icon.setOnClickListener {
            finish()
        }
        initAdapter()
    }



    /**
     * 初始化列表适配器
     */
    private fun initAdapter() {
//        listAdapter.addChildClickViewIds(R.id.text_img, R.id.audio_img)
        listAdapter.setOnItemChildClickListener { adapter, view, position ->
            val any = adapter.data[position] as String
            when (view.id) {
            }
        }
        dataShow.apply {
            layoutManager = LinearLayoutManager(this@VersionActivity)
            adapter = listAdapter
        }

        for (data in 0..40) {
            titles.add("item$data")
        }
        listAdapter.setList(titles)
    }



    override fun showResult(result: String) {
        TODO("Not yet implemented")
    }
}